"""

@File:get_header.py
@Datetime:2022/11/3 23:05
@Author:wangt
@Desc:
"""
import requests


def get_header():
    # 1.登录成功
    url = 'http://ihrm2-test.itheima.net/api/sys/login'
    json = {
        "mobile": "13800000002",
        "password": "123456"
    }

    # 2.获取响应里面的data值.
    res = requests.post(url,json=json)
    token = res.json().get('data')
    # 3.将token值配置在header中
    authorization = "Bearer "+ token
    header = {
        "Content-Type": "application/json",
        "Authorization": authorization
    }
    # 4.一定要返回header值
    return header

if __name__ == '__main__':
    get_header()